package cn.blackjuly.cadmin.model;

import cn.blackjuly.cadmin.model.base.BaseSetting;
import com.jfinal.plugin.activerecord.Db;

@SuppressWarnings("serial")
public class Setting extends BaseSetting<Setting> {
	public static final Setting dao = new Setting().dao();

	public static String findValue(String key) {
		String sql = "select `value` from setting where `key` = ?";
		Setting setting = dao.findFirst(sql, key);
		return setting.getStr("value");
	}

	public static int updateValue(String key, String value) {
		String sql = "update setting set `value` = ? where `key` = ?";
		return Db.update(sql, value, key);
	}
}
